﻿namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_BooleanToInteger_RT : RT_Node
    {
        public RT_SingleValuePort In_Boolean;

        public RT_SingleValuePort Out_Integer;

        public Node_BooleanToInteger_RT(Node_BooleanToInteger sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            In_Boolean = new RT_SingleValuePort(EPortIOType.Input, sourceData.Boolean, this);

            Out_Integer = new RT_SingleValuePort(EPortIOType.Output, sourceData.Integer, this);
            Out_Integer.OnGetValue = GetOutInteger;
        }

        public AValue GetOutInteger(DAG_Executor executor)
        {
            var boolValue = In_Boolean.GetValue(executor) as Value_Boolean;
            Out_Integer.SourceValue.SetBoolean(boolValue.Value);
            return Out_Integer.SourceValue;
        }
    }
}
